home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / Gfx4PCQ.lha / WindowLib / Examples / Jumper2 / Jumper2.p < prev    next >
Encoding:
Text File  |  1997-02-09  |  1023 b   |  65 lines

  1. PROGRAM Jumper;
  2. {Another fractal generator for the windowlib
  3.  © 1997 THOR-Software}
  4.  
  5. {$I "Include:Utils/windowlib.i"}
  6.     
  7. VAR
  8.     a,b,c    :    REAL;
  9.     
  10.     window    :    WindowPtr;
  11.  
  12. {The iteration process}    
  13. PROCEDURE Jumper(window : WindowPtr);
  14. VAR
  15.     x,y    :    REAL;
  16.     tmp    :    REAL;
  17.     i    :    INTEGER;
  18. BEGIN
  19.     
  20.     x:=0;
  21.     y:=0;
  22.  
  23.     {tell windowlib we want to hear if the user shuts down}
  24.     RequestStart(window,CLOSEWINDOW_f);
  25.     REPEAT    
  26.         Plot(window,x*96+320,110-y*48);    {plot a point}
  27.  
  28.         {the iteration formula}
  29.         tmp:=SQRT(ABS(b*x-c));
  30.         IF x=0 THEN
  31.             tmp:=y
  32.         ELSE BEGIN
  33.             IF x>0 THEN
  34.                 tmp:=y-tmp
  35.             ELSE    tmp:=y+tmp
  36.         END;
  37.         y:=a-x;
  38.         x:=tmp;
  39.         {repeat until user shuts down}
  40.     UNTIL NextRequest(window)=CLOSEWINDOW_f;
  41.     
  42. END;
  43.     
  44. BEGIN
  45.     InitGraphics;        {setup gfx}
  46.     
  47.     {open window}
  48.     window:=OpenScreenWindow(NIL,0,0,640,200,2+4+8,"Jumper");
  49.     
  50.     IF window<>NIL THEN BEGIN
  51.         a:=0.4;
  52.         b:=1.0;
  53.         c:=0.0;
  54.         
  55.         Color(window,1);    {choose pen}
  56.         
  57.         Jumper(window);        {draw it}
  58.         
  59.         CloseAWindow(window);    {close window}
  60.     END;
  61.  
  62.  
  63.     ExitGraphics;            {cleanup gfx system}
  64. END.
  65.